<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\ApiResponse;
use App\Spec;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class SpecController extends Controller
{
    use ApiResponse;
    public function index(Request $request)
    {

        $goods_type_id=$request->get('goods_type_id',1);
        if (!$goods_type_id){
            return $this->message_error("数据错误");
        }
        $spec=Spec::with('spec_items')->where('goods_type_id',$goods_type_id)->select(['id','name','sort','status'])->orderBy('sort','desc')->get();
        return $this->data($spec);
    }
}
